package string;


import java.util.Scanner;

public class StringDemo02 {
    public static void main(String []args){
        String str="     Hello   World        ";
        String trim=str.trim();
        System.out.println(str);
        System.out.println(trim);

        System.out.println("--------------------------------");
        /*
        char charAt(int index)
        获取指定位置上的字符

        boolean startsWith
         */
        String str2="HelloWorld";
        char c=str2.charAt(0);
        System.out.println(c);

        boolean starts=str2.startsWith("H");//true
        System.out.println(starts);
        boolean ends=str2.endsWith("md");//false
        System.out.println(ends);
        System.out.println("---------------------------------------------");

        String  str3="http://www.baidu.com";
        boolean starts1=str3.startsWith("http://");
        System.out.println(starts1);
        str3.endsWith(".com");
        System.out.println(str3.endsWith(".com"));
        System.out.println("------------------------======================");

        String s1="我爱java";
        s1.toUpperCase();
        System.out.println( s1.toUpperCase());
        String s2="我爱JAVA";
        s2.toLowerCase();
        System.out.println( s2.toLowerCase());



        String m1="H178ML";

        Scanner sc=new Scanner(System.in);
        System.out.println("请输入验证码！");
        String input=sc.nextLine();
        if (m1.equalsIgnoreCase(input)){
            System.out.println("验证通过！");
        }else{
            System.out.println("无效验证码");
        }













    }
}
